#!/bin/bash

echo "=== 启动HBase集群 ==="
echo ""

# 检查Hadoop状态
echo "1. 检查Hadoop状态..."
jps | grep -E "(NameNode|DataNode|ResourceManager|NodeManager)"
echo ""

# 检查ZooKeeper状态
echo "2. 检查ZooKeeper状态..."
jps | grep QuorumPeerMain
echo ""

# 启动HBase集群
echo "3. 启动HBase集群..."
echo "正在启动HBase Master和RegionServer..."

# 启动HBase
start-hbase.sh

# 等待几秒钟让服务启动
echo "等待服务启动..."
sleep 10

# 检查HBase进程
echo "4. 检查HBase进程..."
echo "HBase Master:"
jps | grep HMaster
echo ""

echo "RegionServer:"
jps | grep HRegionServer
echo ""

# 检查HBase状态
echo "5. 检查HBase状态..."
hbase shell <<< "status"
echo ""

# 检查表
echo "6. 检查现有表..."
hbase shell <<< "list"
echo ""

echo "=== HBase集群启动完成 ==="
echo ""
echo "HBase Web UI地址:"
echo "  Master UI: http://$(hostname -I | awk '{print $1}'):16010"
echo "  RegionServer UI: http://$(hostname -I | awk '{print $1}'):16030"
echo "" 